# -*- coding: utf-8 -*-
from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
from piston.resource import Resource
import rest_api

urlpatterns = patterns('bvsearchapp.views',
    url(r'^companies/$', direct_to_template,
        {'template': "bvsearchapp/companies.html"},
        name='companies_search'),
    url(r'^technologies/$', direct_to_template,
        {'template': "bvsearchapp/technologies_search.html"},
        name='technologies_search'),
    url(r'^medical_conditions/$', direct_to_template,
        {'template': "bvsearchapp/medical_conditions.html"},
        name='medical_conditions_search'),
    url(r'^companies/widget/$', direct_to_template,
        {'template': "bvsearchapp/companies_widget.html"},
        name='companies_widget'),
    url(r'^company/(.+)$', 'company_read', name='company_read'),
    url(r'^test/$', direct_to_template,
        {'template': "bvsearchapp/test2.html"}),
)

urlpatterns += patterns('',
    url(r'^rest_api/companies(?:\.(?P<emitter_format>.+))$',
        Resource(rest_api.CompaniesHandler), name='companies_search_ajax'),
    url(r'^rest_api/company(?:\.(?P<emitter_format>.+))$',
        Resource(rest_api.CompanyHandler), name='company_ajax'),
    url(r'^rest_api/technologies(?:\.(?P<emitter_format>.+))$',
        Resource(rest_api.TechnologiesHandler), name='technologies_search_ajax'),
    url(r'^rest_api/medical_conditions(?:\.(?P<emitter_format>.+))$',
        Resource(rest_api.MedicalConditionsHandler),
        name='medical_conditions_search_ajax'),
)
